package com.cn.serverline.lineicp.workshopPlan.controller;

import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import javax.annotation.Resource;

import com.cn.serverline.lineicp.workshopPlan.entity.PlanLineAutomatic;
import com.cn.serverline.lineicp.workshopPlan.service.IPlanLineAutomaticService;
import org.springframework.validation.annotation.Validated;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * 周总装排产下发 接口
 *
 * @author 田江余
 * @since 2024-08-10
 */
@RestController
@ApiResource(name = "周总装排产下发的接口")
public class PlanLineAutomaticController {

    @Resource(name = "PlanLineAutomaticServiceImpl")
    private IPlanLineAutomaticService iPlanLineAutomaticService;

    /**
     * 添加周总装排产下发
     */
    @PostResource(name = "添加周总装排产下发", path = "/workshopPlan/planLineAutomatic/add")
    public ResponseData<PlanLineAutomatic> add(@RequestBody @Validated PlanLineAutomatic planLineAutomatic){
        iPlanLineAutomaticService.add(planLineAutomatic);
        return new SuccessResponseData<>();
    }

    /**
     * 删除周总装排产下发  撤回
     */
    @PostResource(name = "删除周总装排产下发", path = "/workshopPlan/planLineAutomatic/delete")
    public ResponseData<?> delete(@RequestBody @Validated PlanLineAutomatic  planLineAutomatic){
        iPlanLineAutomaticService.del(planLineAutomatic);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑周总装排产下发
     */
    @PostResource(name = "编辑周总装排产下发", path = "/workshopPlan/planLineAutomatic/edit")
    public ResponseData<?> edit(@RequestBody @Validated PlanLineAutomatic planLineAutomatic) {
        iPlanLineAutomaticService.edit(planLineAutomatic);
        return new SuccessResponseData<>();
    }

    /**
     * 分页查询-周总装排产下发列表
     */
    @GetResource(name = "分页查询-周总装排产下发列表", path = "/workshopPlan/planLineAutomatic/page")
    public ResponseData<PageResult<PlanLineAutomatic>> page(PlanLineAutomatic planLineAutomatic) {
        return new SuccessResponseData<>(iPlanLineAutomaticService.findPage(planLineAutomatic));
    }

}
